package cn.gailvlun.gll.presentation.emotion.util

import android.support.annotation.ColorRes
import android.support.annotation.DrawableRes
import android.support.annotation.FloatRange
import android.support.v4.content.ContextCompat
import android.widget.FrameLayout
import cn.gailvlun.gll.R
import cn.gailvlun.gll.widget.NavigationBarView


class BarBuilder(
        var fakeStatusBar: FrameLayout
) {
    var nbv: NavigationBarView
    
    
    
    var fakeStatusBarBgColor: Int = R.color.transparent
        set(@ColorRes value) {
            fakeStatusBar.setBackgroundColor(ContextCompat.getColor(fakeStatusBar.context, value))
        }

    init {
        nbv = fakeStatusBar.getChildAt(0) as NavigationBarView
    }

    fun back(backFunType: NavigationBarView.() -> Unit) {
        nbv.apply { backFunType() }
    }

    fun title(titleFunType: NavigationBarView.() -> Unit) {
        nbv.apply(titleFunType)
    }

    fun menu(menuFunType: NavigationBarView.() -> Unit) {
        nbv.apply(menuFunType)
    }

    fun change(changeFunType: BarBuilder.() -> Unit) {
        changeFunType()
    }

    inner class Bar(
            @FloatRange(from = 0.0, to = 1.0) nbvAlpha: Float,
            @ColorRes titleColor: Int,
            @DrawableRes backIcon: Int,
            @DrawableRes menuIcon: Int?,
            @ColorRes fakeStatusBarBgColor: Int)


}

